"""
主流程调度脚本
- 包含开始/结束提示、时间统计、进度条逻辑
"""

import time
from tqdm import tqdm
import yaml
import matplotlib.pyplot as plt
from src.aux_utils import aux_des_workflow

if __name__ == "__main__":
    # 强制全局中文字体为 Heiti TC，防止中文乱码
    plt.rcParams['font.sans-serif'] = ['Heiti TC']
    plt.rcParams['axes.unicode_minus'] = False
    print("="*40)
    start_time_str = time.strftime('%Y-%m-%d %H:%M:%S')
    start_time = time.time()
    print(f"⏱ 程序开始运行 {start_time_str}")
    print("="*40)

    # 读取 config.yaml
    with open("config.yaml", "r", encoding="utf-8") as f:
        config = yaml.safe_load(f)
    aux_des_workflow(config)

    end_time_str = time.strftime('%Y-%m-%d %H:%M:%S')
    end_time = time.time()
    print("="*40)
    print(f"⌛️ 程序运行结束 {end_time_str}")
    duration = end_time - start_time
    print(f"总耗时：{int(duration)} 秒（{duration/60:.2f} 分钟）")
    print("="*40)
